<?php
/**
 *
 * UCConfTask class file
 *
 * @category   UC
 * @author     刘海涛 <liuhaitao01@snda.com>
 * @copyright  SDO Group
 * @version    Release: 1.0.0
 * @link       
 * @license    http://www.sdo.com
 */

class UCConfTask
{
	const TASK_DB_FLAG		= 'user_task';
	const TASK_MEMCACHE_FLAG		= 'task';
	const TASK_MEMCACHE_KEY_FRESH	= 'sdo_uc_task_fresh_';
	const TASK_PROFILE_PERCENT		= 50;
	const TASK_RECORD_NUM			= 2;
	const TASK_HAVE_FRIENDS_NUM		= 5;
	const TASK_FRIEND_INTER		= 1;	//双向好友
	const TASK_FRIEND_SINGEL	= 2;	//单向好友


	const AWARD_TYPE_SCORE	= 1;		//积分奖品
	const AWARD_TYPE_METAL	= 2;		//勋章奖品
	const AWARD_TYPE_APP	= 3;		//第三方奖品

	const AWARD_EXPIRE_TIME	= 0;		//奖品过期时间
	
	const TASK_STATUS_ON	= 1;		//任务有效
	const TASK_STATUS_OFF	= 0;		//任务无效

	const TASK_USER_STATUS_GET			= 0;	//任务未完成
	const TASK_USER_STATUS_FINISH		= 1;	//任务完成没领奖
	const TASK_USER_STATUS_AWARD		= 2;	//任务完成已领奖
	//const TASK_USER_STATUS_AWARD_CIRCLE	= 9;	//可重复任务完成已领奖
	//const TASK_USER_STATUS_GET_EXPIRE	= -1;	//任务未完成时间到期
	//const TASK_USER_STATUS_AWARD_EXPIRE	= -2;	//任务未领奖时间到期

	//const TASK_TYPE_GENERAL		= 1;	//一般任务
	//const TASK_TYPE_TIMELIMIT	= 2;	//时间限制任务
	//const TASK_TYPE_CIRCLE		= 3;	//循环任务

	const TASK_ERROR_PARAM			= -1;
	const TASK_ERROR_DB				= -2;
	const TASK_ERROR_USER_EMPTY		= -3;

	const TASK_DONE_PROFILE		= 1;
	const TASK_ADD_FRIENDS		= 2;
	const TASK_INVITE_FRIENDS	= 3;
	const TASK_ADD_RECORDS		= 4;
	
	//错误返回信息
	static public $ar_task_error = array(
											self::TASK_ERROR_PARAM			=> '参数传递错误',
											self::TASK_ERROR_DB				=> '数据库操作错误',
											self::TASK_ERROR_USER_EMPTY		=> '添加任务流水用户ID不存在',
										);

	static public $ar_fresh_task_info = array(self::TASK_DONE_PROFILE,self::TASK_ADD_FRIENDS,self::TASK_INVITE_FRIENDS,self::TASK_ADD_RECORDS);
			
	//任务的详细配置信息
	/*
    static public $ar_task_info = array(
       self::TASK_DONE_PROFILE		=> array( 'name'		=> '完善信息',
											  'status'		=> self::TASK_STATUS_ON,
											  'type'		=> self::TASK_TYPE_GENERAL,
											  'ext'			=> '',
											  'interface'	=> '徐鹏程',
											  'href'		=> '/task/doneprofile',
											  'img'			=> '图片地址',
											  'desc'		=> '描叙信息',
										),
		self::TASK_ADD_FRIENDS		=> array( 'name'		=> '添加5个好友',
											  'status'		=> self::TASK_STATUS_ON,
											  'type'		=> self::TASK_TYPE_GENERAL,
											  'ext'			=> '',
											  'interface'	=> '姜杰',
											  'href'		=> '/task/addfriends',
											  'img'			=> '图片地址',
											  'desc'		=> '描叙信息',
										),
		self::TASK_INVITE_FRIENDS	=> array( 'name'		=> '邀请好友',
											  'status'		=> self::TASK_STATUS_ON,
											  'type'		=> self::TASK_TYPE_CIRCLE,
											  'ext'			=> '',
											  'interface'	=> '姜杰',
											  'href'		=> '/task/invitefriends',
											  'img'			=> '图片地址',
											  'desc'		=> '描叙信息',
										),
		self::TASK_ADD_RECORDS		=> array( 'name'		=> '发表2条记录',
											  'status'		=> self::TASK_STATUS_ON,
											  'type'		=> self::TASK_TYPE_TIMELIMIT,
											  'ext'			=> '0|22:00:00|1',  //  start_time|end_time|add_day
											  'interface'	=> '张利源',
											  'href'		=> '/task/addrecords',
											  'img'			=> '图片地址',
											  'desc'		=> '描叙信息',
										),
    );
	*/
}

function task2dbconfig()
{
	if(DB_DEV_SERVER)
	{
		return array(
			'driver' => 'mysql',
			'host' => '10.129.128.14',
			'port' => '3306',
			'username' => 'root',
			'password' => '123qwe',
			'database' => 'db_task_{substr(abs(crc32($key)),0,1)}',
			'table' => 't_task_{substr(abs(crc32($key)),0,3)}'
		);
	}
	else
	{
		return array(
			'driver' => 'mysql',
			'host' => '127.0.0.1',
			'port' => '3306',
			'username' => 'root',
			'password' => '',
			'database' => 'my_db',
			'table' => 'user_task'
		);
	}
}

?>